import { configure, makeAutoObservable } from "mobx";
import Taro from "@tarojs/taro";

configure({
  enforceActions: "always",
});

class SystemStore {
  constructor() {
    makeAutoObservable(this, {}, { autoBind: true });
  }

  /**
   * 小程序顶部导航栏高度
   */
  navbarHeight: number = (Taro.getSystemInfoSync().statusBarHeight || 0) + 44;

  /**
   * 没有navbar、有tabbar高度
   */
  notNavbarHaveTabbarHeight: string = `calc(100vh - 50px)`;

  /**
   * 有navbar、有tabbar高度
   */
  haveNavbarHaveTabbarHeight: string = `calc(100vh - ${this.navbarHeight}px - 50px)`;

  /**
   * 有navbar、没有tabbar高度
   */
  haveNavbarNotTabbarHeight: string = `calc(100vh - ${this.navbarHeight}px)`;

  systemConfig: any = {};

  setSystemConfig(config) {
    this.systemConfig = config;
  }
}

const systemStore = new SystemStore();
export default systemStore;
